<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>申请提现</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0"> 
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link type="text/css" rel="stylesheet" href="css/style.css" />
    <script type="text/javascript" src="/EasyBuy/statics/js/menu.js"></script>    
	<script type="text/javascript" src="/EasyBuy/statics/js/select.js"></script>
	<script type="text/javascript" src="/EasyBuy/statics/js/jquery-1.8.2.min.js"></script>
	<script type="text/javascript" src="/EasyBuy/statics/js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$("a").removeClass("now");      //移除a元素中值为"now"的class
			$(".reflect").attr("class","now");    //设置本页面class为now
			
			
			$("#reflectmoney").blur(function (){           //钱数 bug 
				if( $("#reflectmoney").val() > $("#hymoney").text()){
					$("#moneydiv").text("提现钱数不能超过当前可用余额");
					$("#moneydiv").css("color","red");
					$("#reflectmoney").focus();
				}else if(reflectmoney < hymoney) {
					$("#moneydiv").text("");
				}
			});
			
			
			
			$("#phone").blur(function (){
				$("#phonediv").text("");
				var phonee = /^0{0,1}(13[0-9]|15[0-9]|153|156|18[7-9])[0-9]{8}$/; //手机号正则
				if($("#phone").val()=="" || $("#phone").val()==null){
					$("#phonediv").text("手机号不能为空");
					$("#phonediv").css("color","red");
				}else if(!phonee.test($("#phone").val())){
					$("#phonediv").text("手机号格式不正确");
					$("#phonediv").css("color","red");
				}
			});	
			$("#account").blur(function (){
				$("#accountdiv").text("");
					var pattern = /^([1-9]{1})(\d{14}|\d{18})$/;   //验证银行卡号
					if($("#account").val()=="" || $("#account").val() ==null){
						$("#accountdiv").text("银行卡号不能为空");
						$("#accountdiv").css("color","red");
					}else if(!pattern.test($("#account").val())){
						$("#accountdiv").text("银行卡号格式不正确");
						$("#accountdiv").css("color","red");
					}
			});
			
			function money(){
				$.get("BalanceServlet","opr=selectBal&userid=${applicationScope.id}",hmoney);
			}
			function hmoney(data){
				$("#hymoney").text(data);
			}
			money();
			
			$(".btn_tj").click(function (){
				$.get("/EasyBuy/BalanceServlet","opr=insert&userid=${applicationScope.id}&money="+$("#reflectmoney").val()+"&remark="+$("#remark").val(),function(){
					if(data == "cg"){
						alert("提现成功");
					}else{
						alert("提现失败");
					}
				});
			});
		});
	</script>
  </head>
  
  <body>
  	
  	<c:choose>
	  	<c:when test="${empty applicationScope.id}">
	  		<% response.sendRedirect("/EasyBuy/pre/Login.jsp");%>
	  	</c:when>
	  	<c:otherwise>
	  		<%@ include file="../../common/header.jsp" %>
			<%@ include file="../../common/backendHeader.jsp" %>
			 <c:choose>
				<c:when test="${empty applicationScope.type }">
					<% 	request.getRequestDispatcher("../../UserServlet?opr=type&href=Member_Address&href1=order").forward(request, response); %>
				</c:when>
				<c:otherwise>
					<c:if test="${applicationScope.type==1 }">
		  				<%@ include file="../../common/sideMamber.jsp" %> 
					</c:if>
					<c:if test="${applicationScope.type==0 }">
						<%@ include file="../../common/sideUser.jsp" %> 
					</c:if>
				</c:otherwise>
			 </c:choose>
	  	</c:otherwise>
  	</c:choose>
	
    <!--Begin 用户中心 Begin -->
		<div class="m_right">
            <p></p>		
			<div class="mem_tit">
            	申请提现
            </div>
            <table border="0" class="mem_tab" style="width:930px; margin-bottom:30px;" cellspacing="0" cellpadding="0">
              <tr>
              	<td class="ma_a" colspan="2" style="padding:12px 50px;">
                	<span class="fl" style="color:#ff4e00; font-size:14px;">会员当前可用余额：￥ <b id="hymoney"></b></span>
                    <span class="fr"><a href="#">账户明细</a>|<a href="#">提现记录</a></span>        
                </td>
              </tr>
              <tr>                                                                                                                                        
                <td width="150" class="tx_l">提现金额</td>                                                                                                                                         
                <td width="680"><input type="text" placeholder="提取金额" class="tx_ipt"  id="reflectmoney"/><div id="moneydiv"></div></td>
              </tr>
              <tr>
                <td class="tx_l">真实姓名</td>
                <td><input type="text" placeholder="姓名填写" class="tx_ipt"  id="name"/></td>
              </tr>
              <tr>
                <td class="tx_l">开户行</td>
                <td><input type="text" placeholder="填写银行名称" class="tx_ipt"  id="bankname"/></td>
              </tr>
              <tr>
                <td class="tx_l">银行账号</td>
                <td><input type="text" placeholder="填写银行账号" class="tx_ipt"  id="account"/><div id="accountdiv"></div></td>
              </tr>
              <tr>
                <td class="tx_l">手机号</td>
                <td><input type="text" placeholder="手机号码" class="tx_ipt" id="phone" /><div id="phonediv"></div></td>
              </tr>
              <tr valign="top">
                <td class="tx_l">备注</td>
                <td><textarea class="tx_txt" placeholder="会员备注" id="remark"></textarea></td>
              </tr>
              <tr height="70">
                <td colspan="2" align="center">
                	<input type="submit" value="提交表单" class="btn_tj" /> &nbsp; &nbsp; <input type="reset" value="重置表单" class="btn_tj" />
                </td>
              </tr>
			</table>
	</div>
   <%@ include file="../../common/footer.jsp" %>    <!--引入下边栏-->
  </body>
</html>
